home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
js
/
win-src.js
< prev
next >
Wrap
Text File
|
2010-05-19
|
44KB
|
1,141 lines
var winMinW=150,winMinH=60;// Minimum window width & height
var winSaveDelay=1000; // timeout between any window modification and position save request
var winSaveTimer; // Timer used for saving windows positions
var winInitialized=0;
var winActive=false;
var winEmptyHTML='';
var seq=0;
var winClosedPosition=new Array();
var winScripts=true;
function winInit(){
if(!dd.ie && !dd.op) winMinH=200;
winInitialized=1;
}
function winCreate(windowId){
var p=winPadding,winHTML='';
var bw=dd.getWndW()-p.left-p.right
var bh=dd.getWndH()-p.top-p.bottom
var winDefaultW=2*bw/3;
var winDefaultH=2*bh/3;
var winDefaultX=p.left+bw/6+30*winList().length;
var winDefaultY=p.top+bh/6+30*winList().length;
winDefaultW=Math.min(winDefaultW,1024);
winDefaultH=Math.min(winDefaultH,768);
if(windowId=='winFake') {
winHTML='<div id="winFake" class="win" style="top:-200px; left:-200px; width:50px; height:50px; position:absolute;"><table class="winActive"><tr> <td class="winTH"><table><tr> <td class="winTL"></td> <td class="winT"><table><tr> <td class="winTT"></td></tr></table></td> <td class="winTR"></td></tr></table></td></tr><tr> <td><table><tr> <td class="winL"></td> <td class="winC"></td> <td class="winR"></td></tr><tr> <td class="winBL"></td> <td class="winB"></td> <td class="winBR"></td></tr></table></td></tr></table><div class="winClose"></div><div class="winMax"></div><div class="winMin"></div><div class="winReload"></div><div class="winReloading"></div><div class="winIcon"></div><div class="winCapt"></div></div>';
if(dd.op || dd.ie) dgi('winDock').outerHTML+=winHTML;
else{
var wDock = D.createElement("div");
var wIdAttr = D.createAttribute("id"); wIdAttr.nodeValue=windowId+"_wDock";wDock.setAttributeNode(wIdAttr);
dgi('winDock').appendChild(wDock);
wDock.innerHTML=winHTML;
}
return;
}
if(!winInitialized) winInit();
if(!dgi('winDock')) return false;
var now = new Date(),loadTs=Date.parse(now.toGMTString());
if(!dgi(windowId)) winHTML+='<div id="'+windowId+'" class="win" style="top:'+winDefaultY+'px; left:'+winDefaultX+'px; width:'+winDefaultW+'px; height:'+winDefaultH+'px; padding:0px;position:absolute;visibility:hidden">';
winHTML+='<table id="'+windowId+'_table" class="winActive" cellpadding="0" cellspacing="0" style="width:100%;height:100%;">';
winHTML+='<tr class="winTTr"><td class="winTH">';
winHTML+='<table cellpadding="0" cellspacing="0" style="width:100%;height:100%;"><tr><td class="winTL" onmouseover="winHover(\''+windowId+'\',\'tl\')" onmouseout="winOut(\''+windowId+'\')"></td><td class="winT" onclick="win(\''+windowId+'\').bringToFront()" ondblclick="win(\''+windowId+'\').toggleState()"><table cellpadding="0" cellspacing="0" style="width:100%;height:100%;"><tr><td class="winTT" onmouseover="winHover(\''+windowId+'\',\'t\')" onmouseout="winOut(\''+windowId+'\')"></td></tr><tr><td style="line-height:1px"> </td></tr></table></td><td class="winTR" onmouseover="winHover(\''+windowId+'\',\'tr\')" onmouseout="winOut(\''+windowId+'\')"></td></tr></table>';
winHTML+='</td></tr><tr><td style="height:100%">';
winHTML+='<table cellpadding="0" cellspacing="0" style="height:100%;width:100%;"><tr><td class="winL" onmouseover="winHover(\''+windowId+'\',\'l\')" onmouseout="winOut(\''+windowId+'\')"></td><td class="winC">';
winHTML+='<div id="'+windowId+'_oif" class="winOIF">'; /* iFrame container */
/* IFRAME */
winHTML+='<iframe id="'+windowId+'_if" name="'+windowId+'_if'+Date.parse(now.toGMTString())+'" frameborder="0" class="winIF" src="'+((W.location.protocol=='https:')?'https://'+W.location.hostname+'/ping.php?check=1':'')+'" onload="if(win(\''+windowId+'\')) win(\''+windowId+'\').setLoaded()" onmouseover="win(\''+windowId+'\').mouseIn()" onmouseout="try{frames[this.name].winMouseOut()} catch(err){}"></iframe>';
if(!dd.ie) winHTML+='<div id="'+windowId+'_mask" class="winMask" style="display:none;'+((dd.op)?'width:100%;height:3px;':'width:100%;height:100%')+'" onmouseover="win(\''+windowId+'\').maskHover()" onclick="win(\''+windowId+'\').activate()"> </div>';
winHTML+='</div>';
winHTML+='</td><td class="winR" onmouseover="winHover(\''+windowId+'\',\'r\')" onmouseout="winOut(\''+windowId+'\')"></td></tr>';
winHTML+='<tr class="winBTr"><td class="winBL" onmouseover="winHover(\''+windowId+'\',\'bl\')" onmouseout="winOut(\''+windowId+'\')"></td><td class="winB" onmouseover="winHover(\''+windowId+'\',\'b\')" onmouseout="winOut(\''+windowId+'\')"></td><td class="winBR" onmouseover="winHover(\''+windowId+'\',\'br\')" onmouseout="winOut(\''+windowId+'\')"></td></tr></table>'
winHTML+='</td></tr></table>';
var aH='<a href="javascript:void(0)" class="';
winHTML+=aH+'winClose" onclick="win(\''+windowId+'\').closeMe()" id="'+windowId+'_close"></a>';
winHTML+=aH+'winMax" onclick="win(\''+windowId+'\').toggleState()" id="'+windowId+'_toggle"></a>';
winHTML+=aH+'winReloading" onclick="win(\''+windowId+'\').reload()" id="'+windowId+'_reload"></a>';
winHTML+=aH+'winMin" onclick="win(\''+windowId+'\').minimize()" id="'+windowId+'_min"></a>';
winHTML+=aH+'winTNW" onclick="win(\''+windowId+'\').toNewWin()" id="'+windowId+'_tnw"></a>';
winHTML+=aH+'winExtra" id="'+windowId+'_extra" style="display:none"></a>';
winHTML+='<div class="winIcon" id="'+windowId+'_icon" onclick="win(\''+windowId+'\').sendToBack()" ondblclick="win(\''+windowId+'\').closeMe()"></div>';
winHTML+='<div class="winARI" id="'+windowId+'_ARI"> </div>';
winHTML+='<div style="display:none">';
winHTML+='<div id="'+windowId+'_reloadSrc"></div>';
winHTML+='<div id="'+windowId+'_reloadType"></div>';
winHTML+='<div id="'+windowId+'_openerId"></div>';
winHTML+='<div id="'+windowId+'_closeFunction"></div>';
winHTML+='</div>';
winHTML+='<div class="winCapt" id="'+windowId+'_capt" ondblclick="win(\''+windowId+'\').toggleState()"></div>';
if(dd.ie) winHTML+='<div id="'+windowId+'_mask" class="winMask" style="display:none;width:30px;height:30px;" onmouseover="win(\''+windowId+'\').maskHover()" onclick="win(\''+windowId+'\').activate()"> </div>';
if(!dgi(windowId)) winHTML+='</div>';
/*
if(dd.op || dd.ie) dgi('winDock').outerHTML+=winHTML;
else{*/
if(dgi(windowId)){
dgi(windowId).innerHTML=winHTML;
}
else{
var wDock = D.createElement("div");
var wIdAttr = D.createAttribute("id"); wIdAttr.nodeValue=windowId+"_wDock";wDock.setAttributeNode(wIdAttr);
dgi('winDock').appendChild(wDock);
wDock.innerHTML=winHTML;
}
//}
ADD_DHTML(windowId+ISWINDOW+RESIZABLE+INERTIA);
if(winEmptyHTML){winIF(windowId).document.write(winEmptyHTML);}
if(!dd.ie) dgi(windowId+"_mask").style.top="0";
if(!dd.ie) dgi(windowId+"_mask").style.left="0";
dgi(windowId+'_close').title=winCaptionClose;
dgi(windowId+'_toggle').title=winCaptionMaximize;
dgi(windowId+'_min').title=winCaptionMinimize;
dgi(windowId+'_tnw').title=winCaptionTNW;
dgi(windowId+'_reload').title=winCaptionReload;
return win(windowId);
}
/**
* Open a window
* locationUrl: target URL
* windowId: id of created window
* windowLable: label (title) of created window
* openerId: id of opener window
*/
function winOpenLocation(locationUrl, windowId, windowLabel, openerId){
if(dgi(windowId) && dgi(windowId).innerHTML.length>0){
dgi(windowId).style.display=="none"; dgi(windowId).style.display="block";
if(openerId) win(windowId).setOpenerId(openerId);
if(W.winMonitor) W.winMonitor(win(windowId),'open');
//win(windowId).setWinState('normal');
win(windowId).activate();
return 'activated';
}
with(w=winCreate(windowId)){
setCaption(windowLabel);
activate();
setIcon("/gfx/logoSmall.png");
setSrc(locationUrl);
setReloadSrc(locationUrl);
if(openerId) setOpenerId(openerId);
}
if(W.winMonitor) W.winMonitor(w,'open');
return 'created';
}
function winSavePosition(){
var GETStr="winUpdate=true";
var nb=0;
var wo;
if(winActive) GETStr+="&winActive="+winActive;
for(var i=0; i<dd.elements.length; i++){
if(dd.elements[i].isIcon){
GETStr+="&name_"+nb+"="+dd.elements[i].name;
GETStr+="&type_"+nb+"=icon";
GETStr+="&x_"+nb+"="+dd.elements[i].x;
GETStr+="&y_"+nb+"="+dd.elements[i].y;
nb++;
}
if(dd.elements[i].isWindow){
if(dgi(dd.elements[i].name+"_reloadSrc").innerHTML.length>0){
wo=win(dd.elements[i].name);
GETStr+="&name_"+nb+"="+wo.id;
GETStr+="&type_"+nb+"=win";
GETStr+="&src_"+nb+"="+encodeURIComponent(dgi(dd.elements[i].name+"_reloadSrc").innerHTML);
GETStr+="&icon_"+nb+"="+encodeURIComponent(dgi(dd.elements[i].name+"_icon").innerHTML);
if(wo.getCaption().length>0) GETStr+="&capt_"+nb+"="+encodeURIComponent(wo.getCaption());
GETStr+="&reloadable_"+nb+"="+wo.reloadable();
GETStr+="&resizable_"+nb+"="+wo.resizable();
GETStr+="&closeable_"+nb+"="+wo.closeable();
if(dd.elements[i].noDrag) GETStr+="&noDrag_"+nb+"=true";
GETStr+="&winState_"+nb+"="+dd.elements[i].winState;
if(dd.elements[i].winState=="normal"){
GETStr+="&x_"+nb+"="+dd.elements[i].x;
GETStr+="&y_"+nb+"="+dd.elements[i].y;
GETStr+="&w_"+nb+"="+dd.elements[i].w;
GETStr+="&h_"+nb+"="+dd.elements[i].h;
}
else{
GETStr+="&x_"+nb+"="+((dd.elements[i].prevX)?dd.elements[i].prevX:dd.elements[i].x);
GETStr+="&y_"+nb+"="+((dd.elements[i].prevY)?dd.elements[i].prevY:dd.elements[i].y);
GETStr+="&w_"+nb+"="+((dd.elements[i].prevW)?dd.elements[i].prevW:dd.elements[i].w);
GETStr+="&h_"+nb+"="+((dd.elements[i].prevH)?dd.elements[i].prevH:dd.elements[i].h);
}
nb++;
}
}
}
clearTimeout(winSaveTimer);
sendData(GETStr,scriptLocation,false);
}
// Return iframe's frame
// objId may be windows id, window object, or any window's child
function winIF(objId){
if(typeof objId=='string') return frames[dgi(objId+"_if").name];
if(dgi(objId.id+"_if")) return frames[dgi(objId.id+"_if").name];
while(!objId.id || !dgi(objId.id+"_if")) {
if((objId.id && objId.id=='winDock')||!objId.parentNode||objId==objId.parentNode) return;
objId=objId.parentNode;
}
return frames[dgi(objId.id+"_if").name];
}
/**
* Restore position of icons and windows on mainFrame load
* @param posArr: array of icons and windows
*/
function winRestorePosition(posArr){
var displayedWin=0,tmpStr,p;
var maxW=((W.innerWidth)?W.innerWidth:D.body.offsetWidth)-winPadding['left']-winPadding['right'];
var maxH=((W.innerHeight)?W.innerHeight:D.body.offsetHeight)-winPadding['top']-winPadding['bottom'];
zindx=600;
for(var i=0; i<posArr.length;i++){
p=posArr[i];
if(p['type']=='win' && !dgi(p["name"])){
with(dWin=winCreate(p["name"])){
p["src"]=p["src"].replace(/&/gi,"&");
if(p["src"].search(/rnd=/)>0){
tmpStr=p["src"].substr(0,p["src"].search(/rnd=/)+4);
p["src"]=p["src"].substr(p["src"].search(/rnd=/)+4);
if(p["src"].search(/&/)>-1) p["src"]=p["src"].substr(p["src"].search(/&/)); else p["src"]="";
p["src"]=tmpStr+Math.random()+p["src"];
}
setSrc(p["src"]);
setReloadSrc(p["src"].replace(/&/gi,"&"));
if(p["capt"]) setCaption(p["capt"]);
if(p["icon"]) setRawIcon(p["icon"]);
p["w"]=Math.min(p["w"],maxW); p['x']=Math.min(p['x'],maxW-p['w']);
p["h"]=Math.min(p["h"],maxH); p['y']=Math.min(p['y'],maxW-p['h']);
moveTo(winPadding['left']+p["x"],winPadding['top']+p["y"]);
resizeTo(p["w"],p["h"]);
if(p["winState"]=="normal"){} else maximize({'noAnimation':1});
if(W.winMonitor) W.winMonitor(dWin,'open');
showMask();
show({'noAnimation':1});
bringToFront();
if(p["active"]) winActive=p["name"];
displayedWin++;
}
}
}
if(winActive) win(winActive).activate();
if(!displayedWin) winCreate('winFake');
}
function winLayoutModified(){
if(winSaveTimer) clearTimeout(winSaveTimer);
winSaveTimer=setTimeout("winSavePosition()", winSaveDelay);
}
/**
* Restore icons position, and generate shadowed caption
*/
function iconRestorePosition(){
var posX=20,posY=20,iconId,i,o,p,nbCar,maxWidth,separator=' ,.;:/_\'"&@-(){}[]?',line1,line2,txt,cut,cn,cnc,zindx=500,c;
var sh={'t':new Array(-1,0),'b':new Array(1,0),'l':new Array(0,-1),'r':new Array(0,1),'br':new Array(1,1)};
for(i=0; i<D.getElementsByTagName("div").length;i++) if((c=D.getElementsByTagName("div")[i]) && c.id.substr(0,8)=="resIcon_"){
iconId=D.getElementsByTagName("div")[i].id.substr(8);
// Set Z-Index to 500+
c.style.zIndex=zindx++;
// Truncate caption
cn=dgi('iconCaption_'+iconId);
cnc=dgi('iconCaption_'+iconId+'_cont');
txt=cn.innerHTML;
nbCar=txt.length;
p=0;
maxWidth=dgi('resIcon_'+iconId).offsetWidth;
if(nbCar>9){
for(o=0;o<nbCar && o<10;o++){
if(separator.indexOf(txt.substr(o,1))!=-1) p=o;
}
cn.innerHTML=txt.substr(0,o).replace(/ /gi,' ');
while(o < nbCar && (cn.offsetWidth + 6) < maxWidth){
o++;
if(separator.indexOf(txt.substr(o,1))!=-1) p=o;
cn.innerHTML=txt.substr(0,o).replace(/ /gi,' ');
}
if(o==nbCar){
line1=txt;
txt='';
}
else{
if(p>0) {
line1=txt.substr(0,p);
txt=txt.substr(p);
}
else{
line1=txt.substr(0,o);
txt=txt.substr(o);
}
}
}
else{
line1=txt;
txt='';
}
if(txt.length>0 && txt.substr(0,1)==' ') txt=txt.substr(1);
nbCar=txt.length; cut=false;
cn.innerHTML=txt.replace(/ /g,' ');
while(nbCar > 3 && cn.offsetWidth + 6 > maxWidth){
txt=txt.substr(0,nbCar--);
cn.innerHTML=txt.replace(/ /g,' ')+"...";
cut=true;
}
txt=line1.replace(/ /g,' ')+'<br>'+txt.replace(/ /g,' ')+(cut?'...':'');
cn.innerHTML=txt;
// Insert caption in shadow spans
cont='';
for(o in sh){
cont+='<span id="iconCaption_'+iconId+'_'+o+'" class="iconCS" style="top:'+sh[o][0]+'px;left:'+sh[o][1]+'px'+((txt.length==0)?';padding-top:0.5em':'')+'">'+txt+'</span>';
}
if(txt.length==0) cn.style.paddingTop="0.5em";
if(line1.length==0) dgi('resIcon_'+iconId+'_img').style.marginTop="5px";
cnc.style.left=dgi('resIcon_'+iconId).offsetWidth/2-cn.offsetWidth/2;
cn.style.left=dgi('resIcon_'+iconId).offsetWidth/2-cn.offsetWidth/2;
cnc.innerHTML=cont;
cn.className='iconC';
if(!dgi('noDrag_'+iconId)) ADD_DHTML("resIcon_"+iconId+ISICON+RESET_Z+INERTIA);
}
iconAdjustIcons();
}
/**
* Readjust all icons position so icons don't overlap
* Called on page load and on resize
*/
function iconAdjustIcons(){
var posX=20,posY=20,o=0,s,iid=[],x=[], y=[],ok,n;
var wp=winPadding,w=dd.getWndW(),h=dd.getWndH(),t=wp.top,l=wp.left;
if(!W.iconsList) return;
for(i=0; i<iconsList.length;i++) {
iid[i]='resIcon_'+iconsList[i][0];
s=dgi(iid[i]).style;
x[i]=s.left.replace(/px/,'')*1.0;
y[i]=s.top.replace(/px/,'')*1.0;
}
for(i=0; i<iid.length;i++) {
if(x[i]+iconWidth > w-wp.right || y[i]+iconHeight > h-wp.bottom || x[i]<l || y[i]<t){
ok=0;
while(!ok){
x[i]=posX; y[i]=posY;
posY+=iconHeight;
if(posY+iconHeight > h-wp.bottom){posY=20;posX+=iconWidth;}
ok=1;
for(o=0;o<x.length;o++){
if(o!=i && Math.abs(x[i]-x[o])<(iconWidth/2) && Math.abs(y[i]-y[o])<(iconHeight/2)){
ok=0;
o=x.length;
}
}
}
n=dd.elements[iid[i]];
n.moveTo(x[i],y[i]); n.defx=x[i]; n.defy=y[i];
}
}
}
function winHover(winId,rDir){
if(dd.obj || dgi(winId).className=='winNR') return;
dd.elements[winId].resizeDir=rDir;
dd.elements[winId].resizeIfPick=true;
}
function winOut(winId){
if(dd.obj||!dd.elements[winId]) return;
dd.elements[winId].resizeDir="";
dd.elements[winId].resizeIfPick=false;
}
// Mouse over iframe
winObj.prototype.mouseIn = function (){try{if(winIF(this).winMouseIn) winIF(this).winMouseIn()} catch(err){}}
// Mouse out of iframe
winObj.prototype.mouseOut = function (){try{winIF(this).winMouseOut()} catch(err){}}
function winCloseAll(){
var f, didClose=true;
if(D.getElementsByTagName("iframe").length==0) return;
while(didClose){
didClose=false;
for(var i=0; i<D.getElementsByTagName("iframe").length; i++){
f=D.getElementsByTagName("iframe")[i];
if(frames[f.id].winMyId) {win(f.id.substr(0,f.id.length-3)).closeMe(); didClose=true;}
}
}
}
function winAdjustWindows(){
winAdjustMaximized();
if(!dd.getWndW()||!dd.getWndH()) return; // Don't resize if browser minimized
var winObj;
for(var i=0; i<dd.elements.length; i++){
winObj=dd.elements[i];
if(winObj.isWindow && winObj.winState!='max'){
if (winObj.x+winObj.w > dd.getWndW()){
if(winObj.w > dd.getWndW()) winObj.resizeTo(dd.getWndW(), winObj.h);
else winObj.moveTo(dd.getWndW()-winObj.w,winObj.y)
}
if (winObj.y+winObj.h > dd.getWndH()){
if(winObj.h > dd.getWndH()) winObj.resizeTo(winObj.w, dd.getWndH());
else winObj.moveTo(winObj.x, dd.getWndH()-winObj.h)
}
}
}
}
function winAdjustMaximized(){
for(var i=0; i<dd.elements.length; i++){
if(dd.elements[i].isWindow && dd.elements[i].winState=='max') dd.elements[i].resizeTo(dd.getWndW(),dd.getWndH());
}
}
function winPicked(){}
function winDropped() {
win(dd.obj.name).hideMask();
dd.obj.resizeIfPick=false;
win(dd.obj.name).activate();
winLayoutModified();
}
function iconDropped() {winLayoutModified();}
function winDebug(message,lineBreak){
if(!dgi('winDebug')) {
w=winCreate('winDebug',true);
w.setCaption('DEBUG');
w.show();
w.bringToFront();
w.moveTo(3*dd.getWndW()/4, 0);
w.resizeTo(dd.getWndW()/4, dd.getWndH());
w.setLoaded();
if(W.winMonitor) W.winMonitor(w,'open');
winIF("winDebug").document.body.innerHTML='';
winIF("winDebug").stop();
}
if(!message) message='<empty>';
var tmp=winIF("winDebug").document.body.innerHTML;
winIF("winDebug").document.body.innerHTML='';
message=""+message;
winIF("winDebug").document.write('<body style="background:white">'+message.replace(/</g,'<')+(lineBreak==undefined?'<br>':'')+tmp);
}
/**
* win Class
*/
function winObj(winId){
if(dgi(winId)) {
this.elt=dgi(winId);
this.id=winId;
}
else{
this.elt=false;
this.id=false;
}
this.fixedSize=false;
}
function win(winId){
if(!dgi(winId)) winId="winFake";
//if(!dgi(winId)) return false;
var wo=new winObj(winId);
return wo;
}
function winSetChildsIds(){
for(var i=0; i<winList().length; i++){
if(winIF(winList(i).id).winMyId && winIF(winList(i).id).winMyId==-1) {
winIF(winList(i).id).winMyId=winList(i).id;
winIF(winList(i).id).winMe=new winObj(winList(i).id);
}
}
return;
}
function winList(itemNb){
var wins=new Array();
nb=0;
for(var i=0; i<dd.elements.length; i++){
if(dd.elements[i].isWindow) wins[nb++]=win(dd.elements[i].name);
}
if((itemNb || itemNb===0) && itemNb<nb) return wins[itemNb];
return wins;
}
winObj.prototype.maskHover = function (){if(!dd.obj && winActive==this.id) win(this.id).hideMask();}
winObj.prototype.showMask = function (){dgi(this.id+"_mask").style.display="block";this.resizeMask();}
winObj.prototype.hideMask = function (){dgi(this.id+"_mask").style.display="none";}
// Resize div mask over iframe and caption div
winObj.prototype.resizeMask = function (){
var i=0,caption=dgi(this.id+'_capt'),w=999,icons=['_close','_toggle','_reload','_tnw','_min','_extra'],it;
// Resize div mask over iframe
if(dd.ie) dgi(this.id+"_mask").style.width=dgi(this.id+"_if").offsetWidth + "px";
if(dd.ie || dd.op) dgi(this.id+"_mask").style.height=dgi(this.id+"_if").offsetHeight + "px";
// Resize caption
for(;i<icons.length;i++) {
it=dgi(this.id+icons[i]);
if(it.style.display!='none') w-=Math.max(w-it.offsetLeft,0);
}
caption.style.width=Math.max(1,w-caption.offsetLeft)+'px'
}
// Move/resize
// Get desktop area width and height
winObj.prototype.desktopSize = function (){return {'w':dd.getWndW(),'h':dd.getWndH()};}
function resizeComplete(){win(dd.obj.name).resized();}
// Resize a window
winObj.prototype.resized = function (){
try{if(winIF(this).winResized) winIF(this).winResized(dgi(this.id+"_if").offsetWidth,dgi(this.id+"_if").offsetHeight);} catch(err){}
winLayoutModified();
}
/**
* Resise window
* @param w: new outer width
* @param h: new outer heigh
* @param centerResize: true to keep window centered on actual position, false to keep top left corner position constant
* @param fastAnim: set to true not apply layout modification and not to apply in-window resize (ie. set when animating window)
*/
winObj.prototype.resizeTo = function (w,h,centerResize,fastAnim){
w=Math.min(this.desktopSize()['w'],w);
h=Math.min(this.desktopSize()['h'],h);
if(!w) w=false;if(!h) h=false;
if(centerResize) dd.elements[this.id].moveBy(w?(dd.elements[this.id].w-w)/2:0,h?(dd.elements[this.id].h-h)/2:0);
dd.elements[this.id].resizeTo(w,h);
this.resizeMask();
if(!fastAnim) this.resized();
}
/**
* Resize window to a given percentage of desktop area
* see resizeTo for parameters description
*/
winObj.prototype.resizeToRelative = function (pw,ph,centerResize,fastAnim){
this.resizeTo(dd.getWndW()*pw/100,dd.getWndH()*ph/100,centerResize,fastAnim);
}
/**
* Resize inner part window (iframe)
* see resizeTo for parameters description
*/
winObj.prototype.resizeInnerTo = function (w,h,centerResize,fastAnim){
// If window is being animated, inner frames have fixed size and may prevent innerWidth to be calculated correctly
if(this.iframe().parentNode.style.width!='100%'){
// Reset iframe and it's outer wrapping sizes
var iFS=this.iframe().style,oiFS=this.iframe().parentNode.style;
iFS.width=iFS.height=oiFS.width=oiFS.height='100%';
}
this.resizeTo((w)?w+this.getOuterWidth()-this.getInnerWidth():false,(h)?h+this.getOuterHeight()-this.getInnerHeight():false,centerResize,fastAnim);
}
winObj.prototype.moveBy = function (x,y,fastAnim){dd.elements[this.id].moveBy(x,y);if(!fastAnim) winLayoutModified();}
winObj.prototype.moveTo = function (x,y,fastAnim){dd.elements[this.id].moveTo(x,y);if(!fastAnim) winLayoutModified();}
// Get X & Y positions
winObj.prototype.getX = function (){return dd.elements[this.id].x}
winObj.prototype.getY = function (){return dd.elements[this.id].y}
// Get window inner width & height
winObj.prototype.getInnerWidth = function (){if(dgi(this.id+"_if")) return dgi(this.id+"_if").offsetWidth;return 100;}
winObj.prototype.getInnerHeight = function (){if(dgi(this.id+"_if")) return dgi(this.id+"_if").offsetHeight;return 100;}
// Get window outer width & height
winObj.prototype.getOuterWidth = function (){return dgi(this.id).offsetWidth}
winObj.prototype.getOuterHeight = function (){return dgi(this.id).offsetHeight}
// Close
winObj.prototype.closeMe = function (){
var n=dgi(this.id+"_close");
if(!n||n.className=="winCloseD") return;
winClosedPosition[this.id]=new Array(dd.elements[this.id].x, dd.elements[this.id].y, dd.elements[this.id].w, dd.elements[this.id].h);
// Stop/abort iframe's connections
try{winIF(this).windowStop();} catch(e){};
// Resource has an onClose function
if(this.getCloseFunction()) try{eval('winIF(this).'+this.getCloseFunction()+'()');} catch(err){};
// FF neverending loading workaround
if(W.phpBrowser && phpBrowser=='gecko') ffLoadWA();
//winIF(this).src='';
// If animate window, fade out
if(windowsAnimation) this.popOut({},'winObjProceedClose("'+this.id+'")');
// Else, directly proceed to window destruction
else winObjProceedClose(this.id);
}
function winObjProceedClose(winId){
if(W.winMonitor && dgi(winId).innerHTML!="") W.winMonitor(win(winId),'close');
if(dd.elements[winId]) dd.elements[winId].del();
if(phpBrowser!='ie') dgi(winId).innerHTML='';
removeNode(dgi(winId));
// Activate next window
for(var i=winList().length-1;i>=0;i--){
if (winList(i).state().substr(0,3)!='min'){
winList(i).activate();
break;
}
}
winLayoutModified();
}
// Load/reload
winObj.prototype.setLoaded = function (){
var n;
// IE everending loading bug workaround
if(phpBrowser=='ie') {n=D.createElement('iframe'); n.style.display='none'; D.body.appendChild(n);}
if(!(n=dgi(this.id+"_reload"))) return;
if(n.style.cursor=="") n.className="winReload"; else n.className="winReloadD";
}
winObj.prototype.setReloading = function (){if(n=dgi(this.id+"_reload")) n.className="winReloading";}
winObj.prototype.reload = function (){
try{if(winIF(this).winPreReload) if(!winIF(this).winPreReload()) return;} catch(err){}
if(this.id=='winDebug') return winIF("winDebug_if").document.body.innerHTML='';
if(dgi(this.id+"_reload").className=="winReloadD") return;
dgi(this.id+"_reload").className="winReloading";
if(dgi(this.id+"_reloadType").innerHTML=='POST'){
winIF(this).location.reload();
}
else{
dgi('reloadForm').a.value=Math.random(999999);
dgi('reloadForm').action=winIF(this).location;
dgi('reloadForm').target = dgi(this.id+"_if").name;
dgi('reloadForm').submit();
}
}
winObj.prototype.goURL= function (URL){winIF(this).document.src=URL}
winObj.prototype.setReloadType = function (rT){if(n=dgi(this.id+"_reloadType")) n.innerHTML=rT;}
// Show / hide asynchronous reload indicator
winObj.prototype.asyncRequestIndicator = function (s){if(n=dgi(this.id+"_ARI")){n.style.display=(s)?'':'none';n.style.visibility='visible'}}
// Maximize/restore/size/move
winObj.prototype.maximize = function (options){
if(!options) options={};
var dWin=dd.elements[this.id];
prevState=dWin.winState;
if(dWin.winState!='max') dWin.prevX=dWin.x;dWin.prevY=dWin.y;dWin.prevW=dWin.w;dWin.prevH=dWin.h;
dWin.nodrag=true;
this.resizeMask();
if(dgi(this.id).className!="winNB") dgi(this.id).className="winNR";
dgi(this.id+"_toggle").className="winRestore";
dgi(this.id+"_toggle").title=winCaptionRestore;
dWin.winState='max';
if(W.winMonitor) W.winMonitor(this,'maximize');
try{if(winIF(this).winStateChanged) winIF(this).winStateChanged(prevState,'max');} catch(err){}
// Animate window
if(windowsAnimation && !options['noAnimation']) {
this.popIn({'destX':winPadding.left,'destY':winPadding.top,'destW':dd.getWndW()-winPadding.left-winPadding.right,'destH':dd.getWndH()-winPadding.top-winPadding.bottom})
}
// Or just resize it
else{
dWin.moveTo(winPadding.left,winPadding.top);
dWin.resizeTo(dd.getWndW()-winPadding.left-winPadding.right,dd.getWndH()-winPadding.top-winPadding.bottom);
}
}
winObj.prototype.restore = function (){
var dWin=dd.elements[this.id],x,y,w,h,ww=dd.getWndW(),wh=dd.getWndH(),p=winPadding;
prevState=dWin.winState;
// Restore from minimized
if(dWin.winState=='minMax' || dWin.winState=='minNormal') {
// Restore previous position
if(dWin.prevX!==undefined){this.moveTo(dWin.prevX,dWin.prevY);this.resizeTo(dWin.prevW,dWin.prevH);}
// Show window
if(windowsAnimation) {
// Compute animation x,y target
x=((p.right>0)?dd.getWndW()-p.right:p.left);
y=((p.bottom>0)?dd.getWndH()-p.bottom:p.top);
this.popIn({'startX':x,'startY':y});
}
else this.show({'noAnimation':1});
if(dWin.winState=='minMax') dWin.winState='max'; else dWin.winState='normal';
try{if(winIF(this).winStateChanged) winIF(this).winStateChanged(prevState,dWin.winState)} catch(err){}
return;
}
// Restore from maximized
if(dWin.prevW>=ww || dWin.prevH>=wh){
x=ww/6;
y=wh/6;
w=2*ww/3;
h=2*wh/3;
if(windowsAnimation){
this.popIn({'destX':x,'destY':y,'destW':w,'destH':h})
}
else{
dWin.moveTo(x,y);
dWin.resizeTo(w,h);
}
}
// ???
else{
if(dWin.prevX+dWin.prevW>ww) x=ww-dWin.prevW; else x=dWin.prevX;
if(dWin.prevY+dWin.prevH>wh) y=wh-dWin.prevH; else y=dWin.prevY;
w=dWin.prevW;h=dWin.prevH;
if(windowsAnimation){
this.popIn({'destX':x,'destY':y,'destW':w,'destH':h})
}
else{
dWin.moveTo(x,y);
dWin.resizeTo(w,h);
}
}
dWin.nodrag=false;
if(dWin.resizable) dgi(this.id).className="win"; else dgi(this.id).className="winNR";
dgi(this.id+"_toggle").className="winMax";
dgi(this.id+"_toggle").title=winCaptionMaximize;
this.resizeMask();
dWin.winState='normal';
if(W.winMonitor) W.winMonitor(this,'restore');
try{if(winIF(this).winStateChanged) winIF(this).winStateChanged(prevState,dWin.winState);} catch(err){}
this.resized();
}
winObj.prototype.state = function (){return dd.elements[this.id].winState;}
winObj.prototype.toggleState = function (){
if(dgi(this.id+"_toggle").className=="winToggleD") return;
var dWin=dd.elements[this.id];
if(!dWin.resizable) return;
if(dWin.winState=='normal') {
this.maximize(this.id);
dgi(this.id+'_toggle').title=winCaptionRestore;
}
else if(dWin.winState=='max') {
this.restore(this.id);
dgi(this.id+'_toggle').title=winCaptionMaximize;
}
}
/**
* Minimize window
*/
winObj.prototype.minimize = function (){
var dWin=dd.elements[this.id],destX,destY,p;
prevState=dWin.winState;
if(dWin.winState=='minMax' || dWin.winState=='minNormal') return;
if(dWin.winState=='max') dWin.winState='minMax'; else dWin.winState='minNormal';
dWin.prevX=dWin.x;dWin.prevY=dWin.y;dWin.prevW=dWin.w;dWin.prevH=dWin.h // Store window position for restore
try{if(winIF(this).winStateChanged) winIF(this).winStateChanged(prevState,dWin.winState);} catch(err){}
if(W.winMonitor) W.winMonitor(this,'minimize');
// (animate) hide window
if(windowsAnimation) {
p=winPadding;
// Compute animation x,y target
destX=((p.right>0)?dd.getWndW()-p.right:p.left);
destY=((p.bottom>0)?dd.getWndH()-p.bottom:p.top);
this.popOut({'destX':destX,'destY':destY});
}
else dWin.hide();
}
/**
* Center window on desktop
*/
winObj.prototype.center = function (){
var p=winPadding;
var nx=p.left/2+(dd.getWndW()-p.right - dd.elements[this.id].w)/2 + dd.getScrollX();
var ny=p.top/2+(dd.getWndH()-p.bottom - dd.elements[this.id].h)/2 + dd.getScrollY();
dd.elements[this.id].moveTo(Math.max(0,nx),Math.max(0,ny));
winLayoutModified();
}
winObj.prototype.toNewWin = function (){
try{if(winIF(this).winPreReload) if(!winIF(this).winPreReload()) return;} catch(err){}
if(dgi(this.id+"_tnw").className=="winTNWD") return;
// Get win src (forbidden on external adresses->try/catch)
var loc;try{loc=winIF(this).src;loc=winIF(this).location} catch(err){loc=dgi(this.id+'_reloadSrc').innerHTML}
// Open new window
if(dgi(this.id+"_reloadType").innerHTML=='POST' && winIF(this).reloadPostData){
W.open(loc,this.id,'resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes')
with(dgi('reloadForm')){
a.value=Math.random(999999);
reloadPostData.value=winIF(this).reloadPostData;
action=winIF(this).location;
target = this.id;
submit();
reloadPostData.value='';
}
}
else W.open(loc,this.id,'resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes')
// Close current window
this.closeMe();
}
winObj.prototype.setSize = function (w,h){
var dWin=dd.elements[this.id];
needCenter=false;
if(dWin.winState=='max'){
this.restore();
needCenter=true;
}
this.resizeTo(w,h);
if(needCenter) this.center();
}
winObj.prototype.freezeSize = function (){
this.resizable(false);
this.fixedSize=true;
}
// Show/fade effect
winObj.prototype.show = function (options){
if(!options) options={};
if(windowsAnimation && !options['noAnimation']) this.popIn(); else {dgi(this.id).style.display="block";dgi(this.id).style.visibility="visible";setAlpha(dgi(this.id),1)}
winLayoutModified();
}
winObj.prototype.hide = function (){
dgi(this.id).style.display="none";
winLayoutModified();
}
// Select a window, activate mask on all other windows
winObj.prototype.select = function (){
winActive=this.id;
for(var i=0; i<dd.elements.length; i++){
if(dd.elements[i].isWindow && dd.elements[i].name!=winActive){
win(dd.elements[i].name).showMask();
dgi(dd.elements[i].name+"_table").className="winInactive";
}
}
dgi(winActive+"_table").className="winActive";
}
winObj.prototype.activate = function (){
var id=this.id,thisWin=win(id),thisElt=dd.elements[id];
if(thisElt.winState=='minMax' || thisElt.winState=='minNormal') this.restore();
thisWin.select();
thisWin.hideMask();
thisWin.bringToFront();
winLayoutModified();
if(W.winMonitor) W.winMonitor(this,'activate');
try{winIF(this).focus();} catch(err){}
}
// Return true if window is active window
winObj.prototype.isActive = function (){return winActive==this.id}
/**
* Show-window animation
* @param targetPosition: if passed, anim from current position to targetPosition{'destX':, 'destY':, 'destW':, 'destH':}
*/
winObj.prototype.popIn = function (targetPosition){
var el,extraParams,iFS=this.iframe().style,oiFS=this.iframe().parentNode.style;
if(!targetPosition) targetPosition={};
// target position passed: anim from current position to targetPosition (same format than extraParams below)
if(targetPosition.targetX!==undefined || targetPosition.destW){
extraParams={'startX':this.getX(),'startY':this.getY(),
'startW':this.getOuterWidth(),'startH':this.getOuterHeight(),
'startIW':this.getInnerWidth(),'startIH':this.getInnerHeight()};
for(el in targetPosition) extraParams[el]=targetPosition[el];
if(!extraParams.destIW){
extraParams.destIW=extraParams.destW-extraParams.startW+extraParams.startIW;
extraParams.destIH=extraParams.destH-extraParams.startH+extraParams.startIH;
}
}
// No passed target: animate from center of screen
else{
extraParams={
'destX':this.getX(),'destY':this.getY(),
'startW':50,'startH':50,
'destIW':this.getInnerWidth(),'destIH':this.getInnerHeight(),
'destW':this.getOuterWidth(),'destH':this.getOuterHeight(),
'fadeIn':1
}
extraParams.startX=extraParams.destX+(extraParams.destW-extraParams.startW)/2;
extraParams.startY=extraParams.destY+(extraParams.destH-extraParams.startH)/2;
// Some parameters may be passed, as startX or startY (restore from minimized)
for(el in targetPosition) extraParams[el]=targetPosition[el];
}
// Compute start window inner width & height
if(extraParams.startIW==undefined){
extraParams.startIW=extraParams.startW-extraParams.destW+extraParams.destIW;
extraParams.startIH=extraParams.startH-extraParams.destH+extraParams.destIH;
}
// Set start position to mouse cursor if not already set
if(W.mouseX) {extraParams.startX=mouseX;extraParams.startY=mouseY-((extraParams.destY<mouseY)?50:0)}
// Resize iframe to destination size to prevent content to be resized during animation
iFS.width=oiFS.width=extraParams.destIW+'px'; iFS.height=oiFS.height=extraParams.destIH+'px';
dgi(this.id).style.visibility='visible'
// Start animation
wl.anim({'item':dgi(this.id),'duration':1000,'extraParams':extraParams,'function':
function(p,anim){
var e=anim.extraParams,it=anim.item,t=win(it.id),wd=dd.elements[it.id],w,h,iF=t.iframe(),oiFS=iF.parentNode.style,iFS=iF.style;
// Set opacity
if(e.fadeIn) setAlpha(it,Math.min(1,2*p))
// Detect window has been resized / moved by an external event during animation => stop animating
if(e.current && ((e.current.x!=wd.x && wd.x>0) || (e.current.w!=wd.w && wd.w<dd.getWndW()-5))){
iFS.width=iFS.height=oiFS.height=oiFS.width='100%';
return{};
}
// Compute new position & size
p=wl.animFunctionUnfold2(p,anim);
w=Math.round(e.startW+p*(e.destW-e.startW));
h=Math.round(e.startH+p*(e.destH-e.startH));
x=Math.round(e.startX+p*(e.destX-e.startX));
y=Math.round(e.startY+p*(e.destY-e.startY));
// Move & resize window object
t.moveTo(Math.max(0,x),Math.max(0,y),1);
it.style.marginLeft=Math.min(0,x)+'px';
it.style.marginTop=Math.min(0,y)+'px';
t.resizeTo(w,h,0,(p==1)?0:1);
// Reset iframe and outer iframe div size
if(p==1){iFS.width=iFS.height=oiFS.height=oiFS.width='100%'}
// Set iframe and outer iframe div size
else if(p!=0){oiFS.width=Math.max(0,w+e.destIW-e.destW)+'px';oiFS.height=Math.max(0,h+e.destIH-e.destH)+'px'}
// Store currently set Width coordinate to detect resize by external events during animation
anim.extraParams.current={'x':wd.x,'y':wd.y,'w':wd.w,'h':wd.h}
return {}; // don't return any css properties to anim function as all resizes/moves have already been done
}
});
}
winObj.prototype.popOut = function (targetPosition,callback){
var e,iFS=this.iframe().style,oiFS=this.iframe().parentNode.style,extraParams={
'startX':this.getX(),'startY':this.getY(),
'startW':this.getOuterWidth(),'startH':this.getOuterHeight(),
'startIW':this.getInnerWidth(),'startIH':this.getInnerHeight(),
'destW':200,'destH':100
}
if(W.mouseX) {extraParams.destX=mouseX-200;extraParams.destY=mouseY}
if(targetPosition) {
for(e in targetPosition) extraParams[e]=targetPosition[e];
extraParams.target=targetPosition;
}
extraParams.destIW=extraParams.startIW;
extraParams.destIH=extraParams.startIH;
// Resize iframe to destination size to prevent content to be resized during animation
iFS.width=extraParams.destIW+'px'; iFS.height=extraParams.destIH+'px';
wl.anim({'item':dgi(this.id),'duration':500,'callbackComplete':callback,'extraParams':extraParams,'function':
function(p,anim){
// p: 0->1
var e=anim.extraParams,t=win(anim.item.id),oiFS=t.iframe().parentNode.style,w,h;
setAlpha(anim.item,Math.max(0,1-2*p))
p=wl.animFunctionFold2(p);
// Outer window size
w=e.startW+(1-p)*(e.destW-e.startW); h=e.startH+(1-p)*(e.destH-e.startH);
if(e.destX!==undefined){
t.resizeTo(w,h,0,1);
t.moveTo(e.startX+(1-p)*(e.destX-e.startX),e.startY+(1-p)*(e.destY-((e.target&&e.destY>e.startY)?e.destH:0)-e.startY))
}
else t.resizeTo(e.startW+(1-p)*(e.destW-e.startW),e.startH+(1-p)*(e.destH-e.startH),1,1);
// inner frame size
oiFS.width=Math.max(1,(w+e.startIW-e.startW))+'px';
oiFS.height=Math.max(1,(h+e.startIH-e.startH))+'px';
return {}; // don't return any css properties to anim function as all resizes/moves have already been done
}
});
}
/**
* Windows layout
*/
// Bring window to front
winObj.prototype.bringToFront = function (){dd.elements[this.id].maximizeZ()}
// Send window to back
winObj.prototype.sendToBack = function (){
var minZ=1000;
for(var i=0; i<dd.elements.length; i++){
if(dd.elements[i].isWindow && dd.elements[i].z<minZ) minZ=dd.elements[i].z;
}
if(dd.elements[this.id].z!=minZ) dd.elements[this.id].setZ(minZ-1);
}
// Window customization
winObj.prototype.setBorderless = function (){dgi(this.id).className="winNB"/*;this.maximize();*/}
winObj.prototype.resetBorders = function (){this.restore();}
winObj.prototype.isBorderless = function (){return dgi(this.id).className=='winNB'}
// Set iframe source
winObj.prototype.setSrc= function (srcURL){dgi(this.id+"_if").src=srcURL;}
// Set URL that will be set on iframe if user reloads page
winObj.prototype.setReloadSrc = function (srcURL){dgi(this.id+"_reloadSrc").innerHTML=srcURL;winLayoutModified();}
// Set ID of of opener window
winObj.prototype.setOpenerId = function (oid){dgi(this.id+"_openerId").innerHTML=oid;}
// Retreive ID of of opener window
winObj.prototype.getOpenerId = function (){return dgi(this.id+"_openerId").innerHTML;}
/**
* Set window title
* @param capt: title
* @param serverSideUpdate: undefined or true to update server-side name of window
*/
winObj.prototype.setCaption = function (capt,serverSideUpdate){
dgi(this.id+"_capt").innerHTML=capt;winLayoutModified();
if((serverSideUpdate||serverSideUpdate==undefined) && W.winMonitor) winMonitor(this,'setCaption');
}
winObj.prototype.getCaption = function (){return dgi(this.id+"_capt").innerHTML;}
// Aliases for get/set caption
winObj.prototype.setTitle = function (capt,serverSideUpdate){this.setCaption(capt,serverSideUpdate)}
winObj.prototype.getTitle = function (){return this.getCaption()}
winObj.prototype.setIcon= function (imageURL){
var iht;
if(imageURL.substr(imageURL.length-4).toLowerCase=='png' && dd.ie && !dd.ie7 && !dd.ie8) {
iht='<div style="display:inline;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+imageURL+'\', sizingMethod=\'scale\');width:100%;height:100%;"></div>';
}
else iht='<img src="'+imageURL+'" alt="" style="width:100%;height:100%;"/>';
dgi(this.id+"_icon").innerHTML=iht;
winLayoutModified();
if(W.winMonitor) W.winMonitor(this,'setIcon');
}
winObj.prototype.getIcon = function (){return dgi(this.id+"_icon").innerHTML;}
winObj.prototype.setRawIcon = function (imageTag){dgi(this.id+"_icon").innerHTML=imageTag;winLayoutModified();}
// Return ID of resource in window
winObj.prototype.getResourceId = function (){try{return this.frame().rID} catch(e){}}
// Return frame object of window
winObj.prototype.frame = function (){return frames[dgi(this.id+"_if").name]}
// Return iframe node
winObj.prototype.iframe = function (){return dgi(this.id+"_if")}
winObj.prototype.setCloseFunction = function (functionName){dgi(this.id+"_closeFunction").innerHTML=functionName;}
winObj.prototype.getCloseFunction = function (){return dgi(this.id+"_closeFunction").innerHTML;}
winObj.prototype.closeable= function (isCloseable){
if(isCloseable){
dgi(this.id+"_close").className="winClose";
}
else if(isCloseable===false){
dgi(this.id+"_close").className="winCloseD";
dgi(this.id+"_icon").ondblclick="";
}
winLayoutModified();
if(dgi(this.id+"_close").className=="winClose") return true; else return false;
}
winObj.prototype.resizable = function (isResizable){
if(isResizable){
dgi(this.id).className="win";
if(this.winState=="max")
dgi(this.id+"_toggle").className="winRestore";
else
dgi(this.id+"_toggle").className="winMax";
}
else if(isResizable===false) {
dgi(this.id).className="winNR";
dgi(this.id+"_toggle").className="winToggleD";
dgi(this.id+"_tnw").className="winTNWD";
}
winLayoutModified();
if(dgi(this.id).className=="win") return true; else return false;
}
winObj.prototype.reloadable = function (isReloadable){
if(isReloadable){
dgi(this.id+"_reload").className="winReload";
dgi(this.id+"_reload").style.cursor="";
}
else if(isReloadable===false) {
dgi(this.id+"_reload").className="winReloadD";
dgi(this.id+"_reload").style.cursor="pointer";
}
winLayoutModified();
if(dgi(this.id+"_reload").className=="winReload") return true; else return false;
}
winObj.prototype.moveable = function (isMoveable){
if(isMoveable){
dd.elements[this.id].setDraggable(true);
}
else if(isMoveable===false) {
dd.elements[this.id].setDraggable(false);
}
winLayoutModified();
return !dd.elements[this.id].nodrag;
}
winObj.prototype.addIcon = function (id, action, cssBackground, title){
if(!dgi(this.id+"_extra"+id)) dgi(this.id+"_extra").innerHTML+='<a id="'+this.id+'_extra'+id+'" class="winExtraIcon"></a>'
dgi(this.id+"_extra"+id).style.background=cssBackground;
dgi(this.id+"_extra"+id).onclick=action;
dgi(this.id+"_extra").style.display='inline';
if(title) dgi(this.id+"_extra").title=title;
}
// Add extra controls in title bar
winObj.prototype.addControls = function (html){
//if(phpBrowser!='opera') try{dgi(this.id+"_extra").innerHTML=html;}
// IE / Opera WA
//catch (err){
var o=dgi(this.id+"_extra");
var n = D.createElement("span");
html.replace(new RegExp('href="javascript:','gi'),'href="#" onclick="'); // WA: button doesn't work if JS put in href
n.innerHTML=html
o.innerHTML=''; o.appendChild(n);
//}
dgi(this.id+"_extra").style.display='';
// Call resizeMask so caption width is resized according to new _extra left border
this.resizeMask();
}
winObj.prototype.getWinState = function (){return dd.elements[this.id].winState;}
winObj.prototype.setWinState = function (newState){dd.elements[this.id].winState=newState;}
winObj.prototype.isFrameless = function (){return false}
winObj.prototype.openWindow = function (url,opt){
if(!opt) opt={};
var w=Math.min(Math.floor(5*dd.getWndW()/6),400); if(opt['w']) w=opt['w'];
var h=Math.min(Math.floor(5*dd.getWndH()/6),320); if(opt['h']) h=opt['h'];
var id=opt['id']||'W'+Math.random();
var caption=(opt['label']!==undefined)?opt['label']:' ';
winOpenLocation(url,id,this.id);
with(win(id)){
resizeInnerTo(w,h);
center();
if(opt['icon']) setIcon(opt['icon']);
if(opt['caption']) setCaption(opt['caption']);
show();
bringToFront();
}
return win(id);
}
// Sync Reload whole desktop
winObj.prototype.reloadDesktop = function (){var URL=D.location.href;if(URL.indexOf('?')>0) URL=URL.substr(0,URL.indexOf('?'));wl.goURL(URL)}